package com.dcivision.framework;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts.action.ActionMessage;


/**
 * save warningMessages
 * @author TC.tang
 * @createDate 2007-1-29
 */
public class ApplicationMessageList{

  private List actionMessageList = null;
  public ApplicationMessageList() {
    actionMessageList = new ArrayList();
  }

  public void addMessage(String key){
    actionMessageList.add(new ActionMessage(key));
  }
  
  public void addMessage(String key,Object msg1){
    actionMessageList.add(new ActionMessage(key,msg1));
  }
  
  public void addMessage(String key,Object[] msgs){
    actionMessageList.add(new ActionMessage(key,msgs));
  }

  public void addMessages(List messageList){
    actionMessageList.addAll(messageList);
  }
  
  public void addMessages(ApplicationMessageList message){
    if(!Utility.isEmpty(message)&&!Utility.isEmpty(message.getActionMessageList())){
      actionMessageList.addAll(message.getActionMessageList());
    }
  }
  
  public void removeMessage(int index){
    actionMessageList.remove(index);
  }
  
  public List getActionMessageList() {
    return actionMessageList;
  }

  public void setActionMessageList(List actionMessageList) {
    this.actionMessageList = actionMessageList;
  }
  
}
